import React from 'react';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import reducer, { getOrderList, filter } from '../../store/user/order';
import MyOrder from '../../components/user/MyOrder';
import { injectReducer } from '../../store/reducers';
import store from '../../store/createStore';
const mapStateToProps = state => ({
  list: state.order.list,
  datasource: state.order.datasource,
  loading: state.order.loading,
  totalNum: state.order.totalNum
});

const mapDispatchToProps = {
  getOrderList,
  filter
};

injectReducer(store, { key: 'order', reducer });
export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(MyOrder)
);
